from django.conf.urls.defaults import *

from piston.resource import Resource
from piston.authentication import HttpBasicAuthentication

from api.handlers import ProjectHandler, ReleaseHandler

auth = HttpBasicAuthentication(realm="My Realm")
ad = { 'authentication': auth }

project_handler = Resource(ProjectHandler, **ad)
release_handler = Resource(ReleaseHandler, **ad)

urlpatterns = patterns('',
   url(r'^projects/(?P<project_slug>[^/]+?)/(?P<slug>[^/]+?)/(?P<emitter_format>.+?)/$', release_handler),
   url(r'^projects/(?P<slug>[^/]+?)/(?P<emitter_format>.+?)/$', project_handler),
   url(r'^$', 'api.handlers.generate_documentation', name="api-doc"),
)
